﻿using SocketBook7Server.db;
using SocketBook7Server.Script.net;
using System;
//using SocketBook7Server.Script.proto;

namespace SocketBook7Server.Script.logic
{
    public partial class MsgHandler
    {
        //获取记事本内容
        public static void MsgGetText(ClientState c, MsgBase msgBase)
        {
            MsgGetText msg = (MsgGetText)msgBase;
            Player player = c.player;
            if (player == null) return;
            //获取text
            msg.text = player.data.text;
            player.Send(msg);
        }
        //保存记事本内容
        public static void MsgSaveText(ClientState c, MsgBase msgBase)
        {
            MsgSaveText msg = (MsgSaveText)msgBase;
            Player player = c.player;
            if (player == null) return;
            //获取text
            player.data.text = msg.text;
            Console.WriteLine("MsgSaveText:" + msg.text);
            DbManager.UpdatePlayerData(c.player.id, c.player.data);
            player.Send(msg);
        }
    }
}
